{extend name="public/base" /}
{block name="head"}
    <meta charset="UTF-8">
    <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />

    <link href="__resource_path__/ui-framework/easyui-1.5.2/themes/metro/easyui-c5a176a3d4.css" rel="stylesheet" />
    <link href="__resource_path__/ui-framework/easyui-1.5.2/themes/icon-77a4ded0c8.css" rel="stylesheet" />

    <link href="__resource_path__/ui-framework/bootstrap/3.0.3/css/bootstrap-a067b6d831.min.css" rel="stylesheet" />
    <link href="__resource_path__/ui-framework/bootstrap-daterangepicker/css/daterangepicker-886dba62c4.css" rel="stylesheet" />
    <link href="__resource_path__/ui-framework/font-awesome/css/font-awesome-a81d284b37.css" rel="stylesheet" />

    <link href="__resource_path__/ui-framework/admin-lte/css/AdminLET-7d58b99a7e.css" rel="stylesheet" />
    <link href="__static_path__/css/base-dc47892812.css" rel="stylesheet" />

    <link href="__resource_path__/ui-framework/jason/searchbox/css/searchbox-398327fb84.css" rel="stylesheet" />
    <link href="__resource_path__/ui-framework/jason/pager/css/pager-f077f5e880.css" rel="stylesheet" />
    <link href="__resource_path__/ui-framework/jason/status/css/status-5f59ab3856.css" rel="stylesheet" />
    <link href="__resource_path__/ui-framework/jason/selector/css/selector-23060c280e.css" rel="stylesheet" />
    <link href="__resource_path__/ui-framework/jason/button/css/button-5ef10c798a.css" rel="stylesheet" />
    <link href="__resource_path__/ui-framework/jason/orderarrow/css/orderarrow-dcf8eba7d1.css" rel="stylesheet" />

    <link href="__static_path__/css/table-0e491bc98f.css" rel="stylesheet" />
    <link href="__static_path__/css/easyui-ext-372f902530.css" rel="stylesheet" />
{/block}
{block name="content"}
        <section class="content">
            <div class="container" style="width: 100%">
                <div class="row">
                    <div class="col-md-5">
                        游戏：魔兽世界
                        <input class="easyui-combobox combobox-f combo-f textbox-f" id="game" data-options="width:125,required:true,editable:false,valueField:'ID',textField:'Name',prompt:'请选择游戏',url:'/game/array',method:'get'" style="display: none;">
                    </div>
                    <div class="col-md-7">
                        导入模板预览：
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-5">
                    <form action="{:url('import')}" method="post" class="ajaxform">
                        <table class="order mt10">
                            <thead>
                            <tr class="header">
                                <td style="width: 5%;">#</td>
                                <td style="width: 30%;">系统的表格导入文本</td>
                                <td style="width: 30%;">我设置的表格导入文本</td>
                                <!-- <td style="width: 15%;">放入导入模版</td> -->
                                <td style="width: 10%;">使用</td>
                                <td style="width: 10%;">大文本框</td>
                            </tr>
                            </thead>
                            <tbody id="settings">
                            {foreach $datalist as $vo}
                            <tr class="project" style="height: 40px;">
                                <td>{$vo.id}</td>
                                <td>
                                    <div id="lbl1">{$vo.title}</div>
                                </td>
                                <td>
                                    <input type="text" value="{$vo.name}" class="fields fl" id="txt1" style="border: 1px solid #c0c0c0; width: 150px; text-indent: 5px;height: 30px" name="{$vo.value}-name">

                                </td>
                                <td>

                                    <input type="checkbox" {if($vo['status']==1)}checked="checked"{/if} id="status1" name="{$vo.value}-status" value="1">

                                </td>
                                <td>
                                     {if($vo['text_type']==1)}
                                     <input type="checkbox" id="bigSize21" name="{$vo.value}-is_text" value="1" {if($vo['is_text']==1)}checked="checked"{/if}>
                                     {/if}
                                </td>
                            </tr>
                            {/foreach}
                            </tbody>
                        </table>
                        </form>
                    </div>
                    <div class="col-md-7">
                        <div>
                            <textarea class="mt10" rows="25" cols="30" id="template" style="padding: 5px;">
{foreach $datalist as $vo}
{if($vo['status']==1)}
{$vo.name}:
{/if}
{/foreach}
                            </textarea>
                        </div>
                        <div class="mt10">
                            <span style="color: red">* 左边的设置改动后，请提交一下，就可以在上面看到修改后的模板哦</span>
                        </div>
                    </div>

                </div>
                <div class="row mt10">
                    <div class="col-md-5" style="text-align: center;">
                        <a id="btnSubmit" href="javascript:" class="btn-action" style="margin: 0px auto;">提交</a>
                    </div>
                    <div class="col-md-7">
                    </div>
                </div>
            </div>
        </section>
{/block}
{block name="script"}
<script src="__resource_path__/libs/jquery/jquery-1-4ed679c998.11.3.min.js"></script>
<script src="__resource_path__/libs/ajaxfileupload-20caa375ef.js"></script>
<script src="__resource_path__/ui-framework/bootstrap/3.0.3/js/bootstrap-7b3098bda9.min.js"></script>
<script src="__resource_path__/ui-framework/bootstrap-daterangepicker/js/moment-zh_cn-3d8809ccd6.js"></script>
<script src="__resource_path__/ui-framework/bootstrap-daterangepicker/js/daterangepicker-bca1a72d19.js"></script>
<script src="__resource_path__/ui-framework/admin-lte/app-bf15eda982.js"></script>
<script src="__static_path__/js/layer/layer.js" /></script>
<script type="text/javascript">
    $().ready(function () {
        var url = $('#hdnURL').val();

        $('.sidebar .treeview').each(function (index, item) {
            var btn = $(this).children("a").first();
            var menu = $(this).children(".treeview-menu").first();

            $(this).find('a').each(function (index, item) {
                if ($(item).attr('href') == url) {
                    menu.show();
                    btn.children(".fa-angle-left").first().removeClass("fa-angle-left").addClass("fa-angle-down");
                }
            });
        });
    });

$('#btnSubmit').click(function(){
    $('.ajaxform').submit();
})

$('.ajaxform').submit(function(e){
     e.preventDefault();
     var form = $(this).serialize();
     $.post('{:url("import")}',form,function(data){
           if (data.success==true) {
              layer.msg('更新成功');
              window.location.reload();
           }
     })
})
</script>
{/block}